<!DOCTYPE html>
<html lang="en">
<head>
	<{include file="header.html"}>
	<title>交易管理-<{$user_data['school_name']}>-德安信会计在线教育平台</title>
</head>
<body>
<div class="wrap">
	<!--star left-->
	<div class="column">
		<{include file="left_menu.html"}>
	</div>
	<div id="ContMianBox">
		<!--star子栏目-->
		<div class="sub-colum">
		    <div class="tit"><{$left_menu_min.menu}></div>
		    <ul>
		        <{foreach from=$left_menu_min.list item=item}>
		        <li <{if $item['url'] == $left_menu_min.curr}>class="curr"<{/if}>><a href="<{$item['url']}>"><{$item['name']}></a></li>
		        <{/foreach}>
		    </ul>
		</div>
		<!--end子栏目-->
		<!--end left-->
		<div class="container narrow">
		    <!--star conter-->
		    <div class="cetContent">
					<div class="tit p-lr20">
					    <span>实训订单</span>
					</div>
					<!--star内容区域-->
					<div class="mainScroll">
					    <div class="mainContainer line-all">
					        <!--star tabMainCont-->
					        <div class="tabMainCont">
								<!--star-->

					            <!--end-->
							<fieldset class="layui-elem-field">
						  		<legend>筛选</legend>
					  			<div class="layui-field-box">
  									<form class="layui-form layui-form-pane1" method="POST" action="/order_shixun" id="order_form">
											<div class="layui-form-item">

											  <div class="layui-inline">
											    <div class="layui-input-inline">
											      <input type="text" name="order_num" placeholder="订单号" autocomplete="off" value='<{if $data['order_num'] != 0}><{$data['order_num']}><{/if}>' class="layui-input">
											    </div>

											  </div>
											  <div class="layui-inline">
                                                    <div class="layui-input-inline">
                                                        <input type="text" name="mobile" placeholder="学员手机号" autocomplete="off" class="layui-input" value='<{if $data['mobile'] != 0}><{$data['mobile']}><{/if}>'>
                                                    </div>
                                                </div>
											</div>
											<div class="layui-form-item">
										    <div class="layui-input-inline">
										      <input class="layui-input" name="st" value="<{if $data['st'] != 0}><{$data['st']}><{/if}>" placeholder="开始日" id="LAY_demorange_s">
										    </div>
												<div class="layui-form-mid">-</div>
										    <div class="layui-input-inline">
										      <input class="layui-input" name="et" value="<{if $data['et'] != 0}><{$data['et']}><{/if}>"  placeholder="截止日" id="LAY_demorange_e">
										    </div>
												<div class="layui-inline">
													<button type="submit" class="layui-btn">搜索</button>
                                                    <button type="button" class="layui-btn" id="total">统计金额</button>
												</div>
										  </div>
					                    </form>
				                  	</div>
									</fieldset>
					            </div>
					            <!--商品列表 star-->
                			<div class="goods_list p-t10">

                                <div class="mtc_tab">
                                    <!--star mt-->
                                    <div class="mt">
                                        <a href="/order_shixun/index/all/<{$data.order_type}>/<{$data.order_num}>/<{$data.st}>/<{$data.et}>/<{$data.mobile}>" <{if $data.status == 'all'}>class="curr"<{/if}>>全部订单</a>
                                        <a href="/order_shixun/index/-1/<{$data.order_type}>/<{$data.order_num}>/<{$data.st}>/<{$data.et}>/<{$data.mobile}>" <{if $data.status == -1}>class="curr"<{/if}>>取消</a>
                                        <a href="/order_shixun/index/0/<{$data.order_type}>/<{$data.order_num}>/<{$data.st}>/<{$data.et}>/<{$data.mobile}>" <{if $data.status == '0'}>class="curr"<{/if}>>待支付</a>
                                        <a href="/order_shixun/index/1/<{$data.order_type}>/<{$data.order_num}>/<{$data.st}>/<{$data.et}>/<{$data.mobile}>" <{if $data.status == 1}>class="curr"<{/if}>>已支付</a>
                                        <a href="/order_shixun/index/2/<{$data.order_type}>/<{$data.order_num}>/<{$data.st}>/<{$data.et}>/<{$data.mobile}>" <{if $data.status == 2}>class="curr"<{/if}>>已发货</a>
                                    </div>
                                    <!--end mt-->
                                    <!--star mc-->
                                    <div class="mc">
                                        <div class="u_table_list m-t20">
                                            <!--star 名称-->
                                            <div class="mtt line-left line-right line-top">
                                                <table>
                                                    <colgroup>
                                                        <col width="35%">
                                                        <col width="10%">
                                                        <col width="8%">
                                                        <col width="10%">
                                                        <col width="13%">
                                                        <col width="10%">
                                                        <col width="15%">
                                                    </colgroup>
                                                    <tbody>
                                                    <tr class="fwb">
                                                        <th>商品</th>
                                                        <th>单价（元）</th>
                                                        <th>数量</th>
                                                        <th>售后</th>
                                                        <th>买家</th>
                                                        <th>实收款(元)</th>
                                                        <th>&nbsp;</th>
                                                    </tr>
                                                    </tbody>
                                                </table>
                                            </div>
                                            <!--end 名称-->
                                            <{foreach from=$order item=item}>
                                            <!--star 商品-->
                                            <div class="table002 line-right line-top m-t20">
                                                <table>
                                                    <colgroup>
                                                        <col width="35%">
                                                        <col width="10%">
                                                        <col width="8%">
                                                        <col width="10%">
                                                        <col width="13%">
                                                        <col width="10%">
                                                        <col width="15%">
                                                    </colgroup>
                                                    <tbody>
                                                    <tr>
                                                        <td class="tb_top" colspan="7">
                                                            <span>订单号: <{$item['order_num']}></span>
                                                            <span class="r">下单时间: <{$item['order_time']|date_format:'%Y-%m-%d %H:%M:%S'}></span>
                                                        </td>
                                                    </tr>
                                                    </tbody>
                                                    <tbody>

                                                    <{foreach from=$item['order_products']|json_decode item=it key=k }>
                                                    <tr>
                                                        <td>
                                                            <div class="product_name">
                                                                <div class="t_img"><img src="<{$it->course_img}>" /></div>
                                                                <div class="t_info">
                                                                    <a target="_blank" href="javascript:;"><{$it->title}></a>
                                                                    
                                                                </div>
                                                            </div>
                                                        </td>
                                                        <td class="not_lb">
                                                            <i class="unit">￥</i>
                                                            <{$it->price|string_format:"%.2f"}>
                                                        </td>
                                                        <td class="not_lb"><{$it->quantity}></td>
                                                        <td class="not_lb"></td>

                                                        <{if $k eq 0 }>
                                                        <td rowspan="<{$item['order_products']|count}>"><span class="c-3b9eeb"><{$item['buyer_user_name']}></span></td>
                                                        <td rowspan="<{$item['order_products']|count}>" class="tac">
                                                            <div class="fwb">
                                                                <i class="unit">￥</i>
                                                                <{$item['total_order_amount']|string_format:"%.2f"}>
                                                            </div>
                                                        </td>
                                                        <td rowspan="<{$item['order_products']|count}>" class="tac">

                                                           <div>
			                                                	<{if $item.order_status == -1}>取消<{/if}>
			                                                	<{if $item.order_status == 0}>待支付<{/if}>
			                                                	<{if $item.order_status == 1}>已支付<p><a class="c-FF0000 send_system_topic" href="javascript:;" url="/order_course_auth/send_school_order_records/<{$it->course_id}>/5/<{$item['order_num']}>">发放激活码</a></p><{/if}>
			                                                	<{if $item.order_status == 2}>已发货<{/if}>
			                                                	<{if $item.order_status == 3}>已收货<{/if}>
			                                                </div>
                                                            <div><a class="c-3b9eeb" href="/orders/detail/<{$item.order_id}>">详情</a></div>
                                                            <{if $item.order_status == 0}>
                                                            <div><a class="c-3b9eeb change_order_price" href="javascript:;" order_id="<{$item['order_id']}>">修改价格</a></div>
                                                            <a class="c-3b9eeb" href="/orders/del/<{$item['order_id']}>">删除订单</a>
                                                            <{/if}>
                                                        </td>
                                                        <{/if}>
                                                    </tr>
                                                    <{/foreach}>
                                                    </tbody>
                                                </table>
                                            </div>
                                            <!--end 商品-->
                                            <{/foreach}>
                                        </div>
                                        <div class="pages" style="padding:20px; text-align:right;">
                                            <{$pagination}>
                                        </div>
                                    </div>
                                    <!--end mc-->
                                </div>
                            </div>
                <!--商品列表 end -->
					        </div>
					        <!--end tabMainCont-->
					        </div>

					    </div>
					</div>
					<!--end内容区域-->
		    <!--end conter-->
		</div>
	</div>
</div>
<{include file="footer.html"}>
<script>
	$(function(){
		$.fn.Dashentab(".cetContent .tit","span",".tabMainCont",".tabItem","curr","click",0);
		$(".sub-colum").find('li').on('click',function(){//子栏目点击选中状态；
			$(this).addClass('curr').siblings().removeClass('curr');
		})
	});
	layui.use('laydate', function(){
	  var laydate = layui.laydate;

	  var start = {
	    min: '2016-11-31 23:59:59'
	    ,max: laydate.now(+1)
	    ,istoday: false
	    ,choose: function(datas){
	      end.min = datas; //开始日选好后，重置结束日的最小日期
	      end.start = datas //将结束日的初始值设定为开始日
	    }
	  };

	  var end = {
	    min: '2016-11-31 23:59:59'
	    ,max: laydate.now(+1)
	    ,istoday: false
	    ,choose: function(datas){
	      start.max = datas; //结束日选好后，重置开始日的最大日期
	    }
	  };

	  document.getElementById('LAY_demorange_s').onclick = function(){
	    start.elem = this;
	    laydate(start);
	  }
	  document.getElementById('LAY_demorange_e').onclick = function(){
	    end.elem = this
	    laydate(end);
	  }

	});
    $(".send_system_topic").click(function(){
        layer.open({
            type: 2,
            title: '激活码列表',
            shadeClose: true,
            shade: 0.8,
            area: ['300px', '90%'],
            maxmin: true,
            content: $(this).attr("url") //iframe的url
        }); 
    })

    $(".change_order_price").click(function(){
        var order_id = $(this).attr("order_id");
        if(order_id == ''){
            layer.msg('订单号错误', {icon:2});
            return false;
        }
        layer.open({
            type: 2,
            title: '激活码列表',
            shadeClose: true,
            shade: 0.8,
            area: ['500px', '370px'],
            maxmin: true,
            content: "/orders/change_order_price/"+order_id //iframe的url
        }); 
    })

    $("#total").click(function(){
        $.ajax({
            type: "POST",
            url: "/orders/get_amount/5",
            dataType:"json",
            async:false,
            data:$("#order_form").serializeArray(),
            contentType:'application/x-www-form-urlencoded',
            success: function(result){
                layer.open({
                    title: '金额统计',
                    content: "当前条件下已付款的订单总金额为："+result+"元"
                });
            }
        });
    })
</script>
</body>
</html>
